package cn.diancan.model.types;

public enum PurchaseSaleOrderCategoryType {

    /**
     * 堂食
     */
    SHOPMEAL(1, "堂食"),
    /**
     * 外卖
     */
    OUTMEAL(2, "外卖");


    private PurchaseSaleOrderCategoryType(int type, String description) {
        this.type = type;
        this.description = description;

    }

    private int type;
    private String description;


    public int getType() {
        return type;
    }

    public String getDescription() {
        return description;
    }

    public static PurchaseSaleOrderCategoryType findType(int type) {
        PurchaseSaleOrderCategoryType enums[] = PurchaseSaleOrderCategoryType.values();
        for (int i = 0; i < enums.length; i++) {
            PurchaseSaleOrderCategoryType singleEnum = enums[i];
            if (singleEnum.getType() == type) {
                return singleEnum;
            }
        }
        return null;
    }

    public static boolean checkExists(Integer type){
        if(null==type){
            return false;
        }
        PurchaseSaleOrderCategoryType enums[] =PurchaseSaleOrderCategoryType.values();
        for (int i = 0; i < enums.length; i++) {
            PurchaseSaleOrderCategoryType singleEnum=  enums[i];
            if (singleEnum.getType() == type) {
                return true;
            }
        }
        return false;
    }
}
